class WelcomeController < ApplicationController
  layout "user"
  def index
    @kw = params[:kw].nil? ? '' : params[:kw]
    if params[:stat].nil?
      @demands = Demand.includes(:offers).where("projects like '%#{@kw}%'").order('created_at desc').paginate :page=> params[:page],:per_page=> 12
    else
      @demands = Demand.includes(:offers).where("projects like '%#{@kw}%' AND status=#{params[:stat].to_s}").order('created_at desc').paginate :page=> params[:page],:per_page=> 12
    end
  end
end
